<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Rule extends Model
{
    public function isValid($path)
    {
        $pattern = "~$this->rule~";
        if (preg_match($pattern, $path)) {
            return $this->type == 'allow';
        } else {
            return $this->type == 'deny';
        }
    }
}
